﻿using System;
using Fly.Data;

namespace FlyWebFrame.Model
{
    public class Schedule:SqlServer
    {

        public Schedule()
        {
            this.table = "schedule";
            this.key = "id";
        }
        public int id;
        public int courseId;
        public string cost;
        public string certs;
        public string language;
        public string lecturer;
        public string location;
        public int dayStart;
        public int dayEnd;
        public int monthStart;
        public int monthEnd;
        public int timeHrs;
        public string time;
        public string course;

        public string title;

        public bool Add()
        {
            return this.Insert("courseId,cost,certs,language,lecturer,location,dayStart,dayEnd,monthStart,monthEnd,timeHrs").Status;
        }

        public Result Get()
        {
            return this.Select(null, null, "monthStart ASC, dayStart ASC", null);
        }

        public Result Get(int pageIndex, int pageSize)
        {
            return this.Select(null, null, "monthStart ASC, dayStart ASC", null, pageIndex, pageSize);
        }

        public Boolean Edit()
        {
            return this.Update("courseId, cost, certs, language, lecturer, location, dayStart, monthStart, dayEnd, monthEnd, timeHrs").Status;
        }
    }
}